
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录页面</title>
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.5.1.js"></script>
    <script>
        function a1() {
            $.post({
                url:"${pageContext.request.contextPath}/l",
                data:{"name":$("#name").val()},
                success:function (msg) {
                    if (msg.toString()=='OK')
                    {
                        $("#userinfo").css("color","green");
                    }else{
                        $("#userinfo").css("color","red");
                    }
                    $("#userinfo").text(msg);
                }
            });
        }
        
        function a2() {
            $.post({
                url:"${pageContext.request.contextPath}/l",
                data:{"pwd":$("#pwd").val()},
                success:function (data) {

                    $("#pwdinfo").text(data);
                    if (data.toString()=='OK')
                    {
                        $("#pwd").css("color","green");
                    }else{
                        $("#pwd").css("color","red");
                    }

                }
            });
        }
    </script>
</head>
<body>
    <p>
        用户名：<input type="text" id="name" onblur="a1()">
    <span id="userinfo"></span>
    </p>
    <p>
        密码：<input type="password" id="pwd" onblur="a2()">
        <span id="pwdinfo"></span>
    </p>
</body>
</html>
